package com.hyh.service;

import android.app.ActivityManager;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.ConnectivityManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.util.Log;

import com.hyh.data.PlatModule;
import com.hyh.receiver.NetworkChangedReceiver;
import com.hyh.receiver.SceenReceiver;
import com.hyh.util.CheckHomeUtil;
import com.hyh.util.NotificationUtil;
import com.hyh.util.ServiceUtil;
import com.hyh.util.SoundUtil;
import com.platform.GosSession;
import com.platform.response.BaseResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/1/27.
 */

public class CoreService extends Service{

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }



    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Notification notification = NotificationUtil.createNotification(this,"语音通讯服务已经启动");
        startForeground(101,notification);

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
        intentFilter.addAction(Intent.ACTION_SCREEN_ON);
        registerReceiver(new SceenReceiver(),intentFilter);

        IntentFilter netStateFilter = new IntentFilter();
        netStateFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        registerReceiver(new NetworkChangedReceiver(),netStateFilter);

        return START_STICKY;
    }

    @Override
    public void onDestroy() {

        super.onDestroy();
    }

}
